package com.zzy.blog.action;

import java.io.IOException;
import java.util.Calendar;

import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class ComputerInfoAction extends ActionSupport{
	
	public void info() throws IOException {
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType("text/html; charset=utf-8");
		response.setCharacterEncoding("utf-8"); 
		response.getWriter().write("{success:true, info:\"7.0, 6.9, 9.5,null, 18.2, 21.5, 25.2,null, 23.3, 18.3, 13.9, 9.6\"}");
	}
	
	
	public void stock() throws IOException {
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType("text/html; charset=utf-8");
		response.setCharacterEncoding("utf-8"); 
		Calendar calendar = Calendar.getInstance();
		calendar.set(2010,0,1,10,8,23);
		System.out.println(calendar.getTime().getTime());
//		String jsonStr = "[[" + calendar.getTimeInMillis() + ", 50.25]]";
		String jsonStr = "[[1130280800000,51.03],[1130281800000,53.03],[1130284800000,57.03],[1130371200000,55.41],[1130457600000,54.47],[1130716800000,57.59],[1130803200000,57.50],[1130889600000,59.95],[1130976000000,61.85],[1131062400000,61.15],[1131321600000,60.23],[1131408000000,59.90],[1131494400000,60.11],[1131580800000,61.18],[1131667200000,61.54]]";
		response.getWriter().write(jsonStr);
	}


}
